feat(observability): configure PostHog error tracking#385
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
8e80334 to
e74924d
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 405e4554ed
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
49a5aac to
5a89430
Compare
- Enable capture_exceptions (unhandled errors + rejections) in the PostHog provider and tag every event with an `environment` super-property derived from NEXT_PUBLIC_VERCEL_ENV (prod/preview/dev). - Report React render errors via posthog.captureException in the shared ErrorBoundary, and wrap the dashboard layout in a PostHogErrorBoundary. - Upload source maps during the build via @posthog/nextjs-config (deleteAfterUpload), gated on POSTHOG_API_KEY, release = commit SHA. - Add POSTHOG_API_KEY / POSTHOG_PROJECT_ID / NEXT_PUBLIC_VERCEL_ENV to the env schema and .env.example. - Mask the raw error message in the shared ErrorBoundary and vertically center the dashboard route error.
5a89430 to
ac6b8b8
Compare
…capture
- Only initialize PostHog on /dashboard routes (lazy init, guarded against
re-init) so auth, marketing, and proxied (docs/blog) paths aren't tracked.
- Guard the shared ErrorBoundary's captureException on a live client
(posthog.__loaded) instead of the env key, so it no-ops where PostHog isn't
initialized rather than dropping events on an uninitialized singleton.
- global-error renders outside the provider tree, so it now initializes its own
minimal client and reports root-layout/provider failures explicitly
(ErrorBoundary report={false} avoids double-capture).
drankou
approved these changes
Jun 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Enables PostHog error tracking for the dashboard. Turns on
capture_exceptions(unhandled errors + rejections) and tags every event with anenvironmentsuper-property (fromNEXT_PUBLIC_VERCEL_ENV) so prod/preview/dev are distinguishable. Currently will be running only inprod.Reports React render errors via
posthog.captureExceptionin the sharedErrorBoundaryand wraps the dashboard layout in aPostHogErrorBoundary. Uploads source maps during the build via@posthog/nextjs-config(gated onPOSTHOG_API_KEY,deleteAfterUpload, release = commit SHA), with the new build-time env vars documented inenv.ts/.env.example.